//
//  QDMessageDetailTableViewCell.swift
//  QDMetroClient
//
//  Created by YueWen on 2019/3/1.
//  Copyright © 2019 YueWen. All rights reserved.
//

import UIKit

/// 消息详情的cell
final class QDMessageDetailTableViewCell: NWTableViewCell {

    /// 背景
    private let backgroundImageView = UIImageView()
    /// 放置小矩形
    private let rectImageView = UIImageView()
    /// 显示的标题
    let titleLabel = UILabel()
    /// 详情信息
    let subtitleLabel = UILabel()
    /// 放置时间的标签
    let timeLabel = UILabel()
    
    
    override func buildView() {
        super.buildView()
        
        backgroundImageView.image = "gen_background".namedImage?.resizableImage(withCapInsets: UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20))
        rectImageView.backgroundColor = QDColors.theme
        
        titleLabel.font = Font.semibold.font(size: 16)
        titleLabel.textColor = QDColors.black
        titleLabel.text = "扣款通知"
        titleLabel.contentScaleFactor = 1
        
        subtitleLabel.font = Font.light.font(size: 14)
        subtitleLabel.textColor = QDColors.black
        subtitleLabel.numberOfLines = 0
        subtitleLabel.text = "您2019年01月31日从芝泉路到苗岭路的乘车订单扣款成功,您2019年01月31日从芝泉路到苗岭路的乘车订单扣款成功"
        
        timeLabel.font = Font.light.font(size: 12)
        timeLabel.textColor = QDColors.gray
        timeLabel.text = "2019-01-30  09:10"
        
        contentView.addSubview(backgroundImageView)
        contentView.addSubview(rectImageView)
        contentView.addSubview(titleLabel)
        contentView.addSubview(subtitleLabel)
        contentView.addSubview(timeLabel)
        
        backgroundImageView.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalToSuperview().offset(13)
            make.right.equalToSuperview().inset(13)
        }
        
        rectImageView.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(20)
            make.top.equalToSuperview().offset(24)
            make.width.equalTo(4)
            make.height.equalTo(14)
        }
        
        titleLabel.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(30)
            make.height.equalTo(22)
            make.top.equalToSuperview().offset(19)
        }
        
        timeLabel.snp.makeConstraints { (make) in
            make.top.equalTo(subtitleLabel.snp.bottom).offset(8)
            make.left.equalToSuperview().offset(30)
            make.height.equalTo(17)
            make.bottom.equalToSuperview().inset(19)
        }
        
        subtitleLabel.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(30)
            make.right.equalToSuperview().inset(30)
            make.top.equalTo(titleLabel.snp.bottom).offset(8)
        }
    }
}
